/* GUI CONVERTED from rssddelb.p (converter v1.75) Sat Aug 12 23:16:20 2000 */
/* rssddelb.p - CHECKS CONFIRMED/UNCONFIRMED SHIPPERS FOR A PO LINE     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*V8:ConvertMode=Maintenance                                            */
/*V8:RunMode=Character,Windows                                          */


/* REVISION: 8.6E   CREATED      : 04/26/00   BY: *L0WT* Kedar Deherkar */
/* REVISION: 9.1   MODIFIED      : 08/12/00   BY: *N0KP* myb            */


         {mfdeclre.i}


         /* CHECK FOR EXISTENCE OF A SHIPPER IN SELECTED DATABASE */

         /* DESCRIPTION FOR INPUT-OUTPUT PARAMETERS               */
         /* L_SHIPPER_FOUND INDICATES COUNT OF UNCONFIRMED SHIPPERS FOR THE */
         /*           PO / PO DETAIL LINE                                   */
         /* L_CONF_SHIP     INDICATES COUNT OF   CONFIRMED SHIPPERS FOR THE */
         /*           PO / PO DETAIL LINE                                   */
         /* L_SAVE_ABS - UNCONFIRMED SHIPPER NUMBER                         */
         /* L_CONF_SHID - CONFIRMED SHIPPER NUMBER                          */

         define input        parameter l_ponbr         like po_nbr     no-undo.
         define input        parameter l_podline       like pod_line   no-undo.
         define input        parameter l_podsite       like pod_site   no-undo.
         define input-output parameter l_shipper_found as   integer    no-undo.
         define input-output parameter l_save_abs      as   character  no-undo.
         define input-output parameter l_conf_ship     as   integer    no-undo.
         define input-output parameter l_conf_shid     like abs_par_id no-undo.

         define variable l_par_recid    as   recid       no-undo.

         define buffer   b_abs_mstr     for  abs_mstr.

         for each abs_mstr
            where abs_order    = l_ponbr   and
                  abs_id begins  "i"     and
                  abs_type     = "r"     and
                  abs_line     = string(l_podline) no-lock:
/*GUI*/ if global-beam-me-up then undo, leave.


            /* ACCUMULATE CONFIRMED SHIPPERS */
            if abs_qty = abs_ship_qty then
            do:
               l_conf_ship = l_conf_ship + 1.

               if l_conf_ship = 1 then
               do:
                  /* FIND TOP LEVEL SHIPPER, IF THE PARENT IS NOT SHIPPER */
                  if substring(abs_par_id,1,1) <> "s" then
                  do:

                     /* FIND TOP LEVEL SHIPPER */
                     {gprun.i ""gpabspar.p"" "(input recid(abs_mstr),
                                               input 'S',
                                               input false,
                                               output l_par_recid)" }
/*GUI*/ if global-beam-me-up then undo, leave.


                     if l_par_recid <> ? then
                     do:
                        for first b_abs_mstr
                           fields (abs_id abs_line abs_order abs_par_id
                                   abs_qty abs_ship_qty abs_type)
                           where recid(b_abs_mstr) = l_par_recid no-lock :
                        end. /* FOR FIRST B_ABS_MSTR */

                       if available b_abs_mstr then
                          l_conf_shid = b_abs_mstr.abs_id.
                     end. /* IF L_PAR_RECID <> ? */

                  end. /* IF SUBSTRING(ABS_PAR_ID,1,1) <> "S" */
                  else
                     l_conf_shid = abs_mstr.abs_par_id.

               end. /* IF L_CONF_SHIP = 1 */

            end. /* IF ABS_QTY = ABS_SHIP_QTY */

            /* ACCUMULATE UNCONFIRMED SHIPPERS */
            else
            do:
               l_shipper_found = l_shipper_found + 1.

               if l_shipper_found = 1 then
                  l_save_abs = abs_mstr.abs_par_id.

            end. /*  ABS_QTY <> ABS_SHIP_QTY */

         end. /* FOR EACH ABS_MSTR */
